<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>狼途汽车门店管理平台-登录</title>
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="/js/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/js/Ionicons/css/ionicons.min.css">
    <link rel="stylesheet" href="/js/adminlte/css/AdminLTE.min.css">
    <link rel="stylesheet" href="/js/adminlte/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="/js/adminlte/css/fonts.googleapis.com.css">

    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.js"></script>
    <script src="/js/adminlte/js/adminlte.min.js"></script>

    <link rel="stylesheet" href="/js/plugins/sweetalert2/sweetalert2.min.css">
    <script src="/js/plugins/sweetalert2/sweetalert2.min.js"></script>
</head>


<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        <a href="http://www.wolfcode.cn"><b>狼途</b>汽车门店管理平台</a>
    </div>

    <div class="login-box-body">
        <p class="login-box-msg">请输入账号密码</p>

        <form id="loginForm" >
            <div class="form-group has-feedback">
                <input type="text" class="form-control" placeholder="请输入账号"
                       value="admin" name="username" id="username">
                <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" class="form-control" placeholder="请输入密码"
                       value="123" name="password" id="password">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
          <span id="verCodemsg"></span>
            <div class="form-group has-feedback">
                <img src="/captcha" width="280px" height="48px" />
                <input type="text" class="form-control" name="verCode" id="verCode">
                <span class="glyphicon glyphicon-info-sign form-control-feedback"></span>
            </div>
            <div class="row">
                <div class="col-xs-4">
                    <button type="button" class="btn btn-primary btn-block btn-flat submitBtn">登录</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script>

    // $('#verCode').change(function () {
    //     var ve = $('#verCode').val();
    //     $.ajax({
    //         url: "/login",
    //         type:"Post",
    //         data: {verCode:ve},
    //         error:function (data) {
    //            $('#verCodemsg').val(data.msg)
    //         }
    //     })
    //
    // })

$(function () {


    $('.submitBtn').click(function () {
        $.ajax({
            url: '/employee/login',
            data: {
                username: $('#username').val(),
                password: $('#password').val(),
                verCode: $('#verCode').val()
            },
            success: function (data) {
                if (data.success) {
                    window.location.href = '/employee/list';
                } else {
                    Swal.fire({
                        title: '登录异常!',
                        text: data.msg,
                        icon: 'error',
                        timer: 3000
                    });
                }
            },
            error: function () {
            }
        });
    });

})
</script>
</body>
</html>